﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for cls_HOADON
/// </summary>
public class cls_HOADON
{
	public cls_HOADON()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public static DataTable GetByTungay_Denngay(DateTime TuNgay, DateTime DenNgay)
    {
        DataTable dt = new DataTable();
        SqlParameter[] para = new SqlParameter[2];
        para[0] = new SqlParameter("@TuNgay", TuNgay);
        para[1] = new SqlParameter("@DenNgay", DenNgay);

        DatabaseConnect connect = new DatabaseConnect();
        try
        {
            dt = connect.GetSelectCommand("Select_tbDONGPHI_THEONGAY", para);
        }
        catch
        {
            dt = null;
        }
        return dt;
    }
    public static DataTable GetBy_MACN_Tungay_Denngay(string F_MACN, DateTime TuNgay, DateTime DenNgay)
    {
        DataTable dt = new DataTable();
        SqlParameter[] para = new SqlParameter[3];
        para[0] = new SqlParameter("@TuNgay", TuNgay);
        para[1] = new SqlParameter("@DenNgay", DenNgay);
        para[2] = new SqlParameter("@F_MACN", F_MACN);

        DatabaseConnect connect = new DatabaseConnect();
        try
        {
            dt = connect.GetSelectCommand("Select_tbDONGPHI_MACN_TUNGAY_DENNGAY", para);
        }
        catch
        {
            dt = null;
        }
        return dt;
    }
    public static DataTable GetBy_MACN_Tungay_Denngay_LocHoaDonChuaIn(string F_MACN, DateTime TuNgay, DateTime DenNgay)
    {
        DataTable dt = new DataTable();
        SqlParameter[] para = new SqlParameter[3];
        para[0] = new SqlParameter("@TuNgay", TuNgay);
        para[1] = new SqlParameter("@DenNgay", DenNgay);
        para[2] = new SqlParameter("@F_MACN", F_MACN);

        DatabaseConnect connect = new DatabaseConnect();
        try
        {
            dt = connect.GetSelectCommand("Select_tbDONGPHI_MACN_TUNGAY_DENNGAY_LocHoaDonChuaIn", para);
        }
        catch
        {
            dt = null;
        }
        return dt;
    }
    public static DataTable GetBy_MACN_Tungay_Denngay_LocDaIn_ChuaIn(string F_MACN, DateTime TuNgay, DateTime DenNgay,string status)
    {
        DataTable dt = new DataTable();
        SqlParameter[] para = new SqlParameter[4];
        para[0] = new SqlParameter("@TuNgay", TuNgay);
        para[1] = new SqlParameter("@DenNgay", DenNgay);
        para[2] = new SqlParameter("@F_MACN", F_MACN);
        para[3] = new SqlParameter("@status", status);

        DatabaseConnect connect = new DatabaseConnect();
        try
        {
            dt = connect.GetSelectCommand("Select_tbDONGPHI_MACN_TUNGAY_DENNGAY_LocDaIn_ChuaIn", para);
        }
        catch
        {
            dt = null;
        }
        return dt;
    }
    public static DataTable GetAll()
    {
        DataTable dt = new DataTable();
        //SqlParameter[] para = new SqlParameter[2];
        //para[0] = new SqlParameter("@TuNgay", TuNgay);
        //para[1] = new SqlParameter("@DenNgay", DenNgay);

        DatabaseConnect connect = new DatabaseConnect();
        try
        {
            dt = connect.GetSelectCommand("Select_tbDONGPHI_All", null);
        }
        catch
        {
            dt = null;
        }
        return dt;
    }
}